import request from '@/utils/request'

// 查询商品分类列表
export function listCategories(query) {
  return request({
    url: '/commodity/category/list',
    method: 'get',
    params: query
  })
}

// 查询商品分类详细
export function getCategory(id) {
  return request({
    url: '/commodity/category/detail/' + id,
    method: 'get'
  })
}

// 新增商品分类
export function addCategory(data) {
  return request({
    url: '/commodity/category/add',
    method: 'post',
    data: data
  })
}

// 修改商品分类
export function updateCategory(data) {
  return request({
    url: '/commodity/category/update',
    method: 'put',
    data: data
  })
}

// 删除商品分类
export function deleteCategory(id) {
  return request({
    url: '/commodity/category/deleteById/' + id,
    method: 'delete'
  })
}

// 批量删除商品分类
export function deleteCategories(ids) {
  return request({
    url: '/commodity/category/deleteByIds/' + ids,
    method: 'delete'
  })
} 